package top.soulblack.purchasesale.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import top.soulblack.purchasesale.model.GoodsStyle;

import java.util.List;

/**
 * create by 小川
 */

@Mapper
public interface GoodsStyleMapper {

    List<Integer> deleteById(Integer id);

    int insert(GoodsStyle record);

    int insertSelective(GoodsStyle record);

    GoodsStyle selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(GoodsStyle record);

    int updateByPrimaryKey(GoodsStyle record);

    @Select("select * from goods_style")
    List<GoodsStyle> selectAll();

    @Select("select distinct `classify` from goods_style")
    List<String> selectclassif();

    @Select("select * from goods_style where `classify` = #{classify}")
    List<GoodsStyle> selectForClassify(@Param("classify") Integer classify);

    @Insert("insert into goods_style (name, `classify`) values (#{name}, #{classify})")
    void addStyle(GoodsStyle goodsStyle);

    @Select("select count(*) from goods_style where name = #{name}")
    int existStyle(String name);

    @Select("select style from goods where style = #{id}")
    List<Integer> selectStyle(@Param("id") Integer id);
}
